package com.chen.user.controller;


import com.chen.user.common.Result;
import com.chen.user.request.OrderRequest;
import com.chen.user.response.OrderResponse;
import com.chen.user.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/user/order")
public class OrderController {

    @Autowired
    private OrderService orderService;

    @PostMapping("/addOrder")
    public Result addOrder(@RequestBody OrderRequest orderRequest){
      Result result=  orderService.addOrder(orderRequest);
      return result;
    }

    @GetMapping("/getOrder")
    public Result<OrderResponse> gerOrder()
    {
       OrderResponse orderResponse= orderService.getOrder();
       return Result.success(orderResponse);
    }

}
